import { defineNuxtConfig } from 'nuxt/config'
import { resolve } from 'path';
import { fileURLToPath } from 'url';

// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  app: {
    baseURL: '/',
    // NUXT_APP_CDN_URL=https://mycdn.org/ 
    cdnURL: '',
  },
  // https://devtools.nuxt.com/guide/getting-started
  devtools: { enabled: true },
  modules: [
    '@nuxt/devtools',
  ],
  dir: {
    pages: 'src/views',
    layouts: 'src/layouts',
    assets: 'src/assets',
    middleware: 'middleware',
    modules: 'modules',
    plugins: 'plugins',
    public: 'public',
  },
  alias: {
    '@': resolve(__dirname, 'src'),
    'images': fileURLToPath(new URL('./assets/images', import.meta.url)),
    'style': fileURLToPath(new URL('./assets/style', import.meta.url)),
    'data': fileURLToPath(new URL('./assets/other/data', import.meta.url))
  },
  /** vite配置 */
  vite: {
    vue: {
      customElement: true,
    },
    vueJsx: {
      mergeProps: true,
    },
  },
  webpack: {
    analyze: true,
  }
})
